(() => {
  function greeter (person: string) {
    return 'Hello, ' + person
  }
  
  // let user = 'Yee2222223333333333'
  let user = {}
  
  // console.log(greeter(user))
})();

(() => {
  interface Person {
    firstName: string
    lastName: string
  }
  
  function greeter (person: Person) {
    return 'Hello, ' + person.firstName + ' ' + person.lastName
  }
  
  let user = {
    firstName: 'Yee',
    lastName: 'Huang'
  }
  
  console.log(greeter(user))
})();

(() => {
  class User {
    fullName: string
    firstName: string
    lastName: string
  
    constructor (firstName: string, lastName: string) {
      this.firstName = firstName
      this.lastName = lastName
      this.fullName = firstName + ' ' + lastName
    }
  }
  
  interface Person {
    firstName: string
    lastName: string
  }
  
  function greeter (person: Person) {
    return 'Hello, ' + person.firstName + ' ' + person.lastName
  }
  
  let user = new User('Yee', 'Huang')
  
  console.log(greeter(user))
})()


/* 
在编码过程中, 有比较好的补全提示
在编码过程中, 如果编码有错, 会及时提示错误, 而不运行代码时

语法更多了, 代码更多了
*/